<%-- 
    Document   : register
    Created on : Apr 9, 2011, 12:39:18 AM
    Author     : Stefan
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@ taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@ taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<c:if test="${registeredUserBean.loggedIn}">
	<c:redirect url="/user/home.faces"/>
</c:if>

<f:view>
    <a4j:keepAlive beanName="registrationBean"/>
    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
            <title>Registration</title>
            <link rel="stylesheet" href="/EvIn/styles/styles.css" type="text/css" />
        </head>

        <body style="background-color: white">

            <div id="wrapper" style="background-color: white;width: 700px">
                <div class="fullpane" style="background-color: white">

					<div align="center">
						<img src="/EvIn/static/images/logo1.png" width="70%"/>
					</div>
					<hr/>
                    <div align="center">
                        <h:form id="register">
                            <f:verbatim>
                                <div style="font-size: 11px" align="right">
                                    Already a member? login <a href="index.faces">here</a>
                                </div>
                            </f:verbatim>
                            <rich:panel style="border:none">

                                <h:panelGrid columns="3" >
                                    <h:outputLabel for="username" value="Email :  " />
                                    <h:inputText  required="true" id="username"  value="#{registrationBean.email}" requiredMessage="Email is required">
                                        <f:validator validatorId="EmailValidator" />
                                    </h:inputText>   
                                    <h:message  for="username" style="color: red; font-size: 10px"/>

                                    <h:outputLabel for="password" value="Password :  "/>
                                    <h:inputSecret  id="password" value="#{registrationBean.password}" required="true" requiredMessage="Password is required">
                                        <f:validateLength minimum="5"/>
                                    </h:inputSecret>
                                    <h:message for="password" style="color: red; font-size: 10px"/>

                                    <h:outputLabel for="password_confirm" value="Confirm Password:  "/>
                                    <h:inputSecret  id="password_confirm" value="#{registrationBean.passwordConfirm}" required="true" requiredMessage="Confirmation required">
                                        <f:validateLength minimum="5"/>
                                    </h:inputSecret>
                                    <h:message for="password_confirm" style="color: red; font-size: 10px"/>

                                    <h:outputLabel for="fist_name" value="First Name :  " />
                                    <h:inputText  required="true" id="fist_name"  value="#{registrationBean.firstName}" requiredMessage="Email is required">
                                        <f:validateLength minimum="3" />
                                    </h:inputText>
                                    <h:message  for="fist_name" style="color: red; font-size: 10px"/>

                                    <h:outputLabel for="last_name" value="Last Name :  " />
                                    <h:inputText  required="true" id="last_name"  value="#{registrationBean.lastName}" requiredMessage="Email is required">
                                        <f:validateLength minimum="3" />
                                    </h:inputText>
                                    <h:message  for="last_name" style="color: red; font-size: 10px"/>

                                    <h:commandButton  action="#{registrationBean.register}" value="Register"/>
                                    <h:messages globalOnly="true" style="color: red; font-size: 10px"/>
                                    
                                </h:panelGrid>
                            </rich:panel>
                        </h:form>
                    </div>
                </div>
            </div>
        </body>
    </html>
</f:view>
